<template id="make">
  <div>
    <el-input style="width: 25%;" v-model="name" placeholder="请输入名称"></el-input>
        &nbsp;&nbsp;
        <el-button style="width: 15%;" @click="queryAll" type="primary">查询</el-button>
        <el-button style="width: 15%;" @click="kk=true"  type="primary">添加</el-button>
        <el-table :data="list">
        <el-table-column prop="id" v-if="false" label="编号"> 
        </el-table-column>
        <el-table-column prop="makedate" label="预约日期">
        </el-table-column>
        <el-table-column prop="vipid" label="档案号">
        </el-table-column>
        <el-table-column prop="name" label="姓名">
        </el-table-column>
        <el-table-column prop="sj" label="手机号">
        </el-table-column>
        <el-table-column prop="maketype" label="预约类型">
        </el-table-column>
        <el-table-column prop="makestatus" label="预约状态">
            <template slot-scope="scope">
                {{ scope.row.makestatus==0?"未预约":"已预约" }}
            </template>
        </el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-button type="primary"  icon="el-icon-edit" @click="queryId(scope.row.id),up=true"  circle></el-button>
            <el-popconfirm @confirm="del(scope.row.id)" title="这是一段内容确定删除吗">
            <el-button type="danger" slot="reference" icon="el-icon-delete" circle></el-button>
          </el-popconfirm>
          </template>
        </el-table-column>
      </el-table>

      <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage4"
      :page-sizes="[3, 5, 7, 10]"
      :page-size="pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
    </el-pagination>

    <!-- 添加 -->
    <el-dialog
    title="添加"
    :visible.sync="kk"
    width="50%"
    center>
    <el-form :model="make" status-icon  ref="make" label-width="100px" class="demo-ruleForm">
        <el-tabs v-model="tj" type="card" >
            <el-tab-pane label="用户管理" name="aa">
                姓名: &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<el-input v-model="make.name" style="width: 40%;"/>
                        &nbsp;&nbsp;
                
                手机号:&nbsp;&nbsp;<el-input v-model="make.sj" style="width: 40%;"></el-input>
                        <h1></h1>
                年龄: &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<el-input v-model="make.age" style="width: 40%;"/>
                &nbsp;&nbsp;
                身份证:&nbsp;&nbsp;<el-input v-model="make.certificate" style="width:40%;"/><br>
                <h1></h1>
                出生日期:<el-date-picker v-model="make.datebirth"  placeholder="选择日期" style="width: 40%;"></el-date-picker>
                &nbsp;&nbsp;
               
                适用性别:<el-select v-model="make.sex" style="width:40%;">
                            <el-option label="不限" value="0"></el-option>
                            <el-option label="男" value="1"></el-option>
                            <el-option label="女" value="2"></el-option>
                        </el-select><br>
                <h1></h1>
                婚姻状态:<el-select v-model="make.maritalstatus" style="width: 40%;">
                            <el-option label="已婚" :value="1"></el-option>
                            <el-option label="未婚" :value="0"></el-option>
                        </el-select>
                &nbsp;&nbsp;
                预约时间:<el-date-picker v-model="make.makedate" style="width: 40%;" placeholder="选择日期"/>
                <h1></h1>
               
            </el-tab-pane>

            <el-tab-pane label="套餐" name="second">
              <el-table 
                  ref="multipleTable"
                  :data="listMeal"
                  tooltip-effect="dark"
                  style="width: 100%"
                  >
                  <el-table-column type="selection" label="id" >
                     <template slot-scope="scope">
                      <input type="checkbox" @click="chckeds($event,scope.row.id)">
                     </template>
                  </el-table-column>
                  <el-table-column prop="mc" label="套餐名称">
                  </el-table-column>
                  <el-table-column prop="sex" label="适用性别">
                    <template slot-scope="scope">
                        {{ scope.row.sex==0?"不限"
                            :scope.row.sex==1?"男":"女"
                        }}
                    </template>
                  </el-table-column>
                  <el-table-column prop="mealintroduce" label="套餐介绍">
                  </el-table-column>
                  
                  <el-table-column prop="id" label="编号" v-if="false">
                  
                  </el-table-column>
              </el-table>

              <el-pagination
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :current-page="Page4"
                :page-sizes="[3, 5, 7, 10]"
                :page-size="size"
                layout="total, sizes, prev, pager, next, jumper"
                :total="total">
              </el-pagination>
            </el-tab-pane>
        </el-tabs>
    <el-button @click="reset('meal'),kk = false">取 消</el-button>
    <el-button type="primary" @click="kk = false,add()" >确 定</el-button>
  </el-form>
  </el-dialog>
  </div>
</template>

<script>
export default {
    data(){
        return{
            tj:'aa',
            meal:[],
            kk:false,
            name:"",
            listMeal:[],
            list:[],
            total:10,
            pageSize:4,
            size:4,
            Page4:1,
            currentPage4:1,
            make:{name:"",certificate:"",sj:"",age:"",datebirth:"",maritalstatus:"",makedate:"",sex:""}
        }
    },
    methods:{
        queryMeal(){
        this.axios.post("/tomcat/Z_queryMeal",{page:this.Page4,num:this.size}).
        then(s=>{
          this.total=s.data.total
          this.listMeal=s.data.rows
        })
      },
        queryAll(){
            this.axios.post("/tomcat/Z_queryMake",{num:this.pageSize,page:this.currentPage4,name:this.name}).then(s=>{
                console.log(s.data)
                this.total=s.data.total
                this.list=s.data.rows
            })
        }
    },
    created(){
        this.queryAll();
        this.queryMeal();
    }
}
</script>

<style>

</style>